package webTest.myTag.SimpleTag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;

/**
 * Created by IFT8 on 2015/3/18.
 */
public class IP extends SimpleTagSupport {
    @Override
    public void doTag() throws JspException, IOException {
        super.doTag();
        PageContext pageContext = (PageContext) getJspContext();
        String ip = pageContext.getRequest().getRemoteAddr();
        pageContext.getOut().print(ip);
        //执行标签体内容
        getJspBody().invoke(null); //参数null是默认输出流
    }
}
